﻿<%@ Page Language="C#" MasterPageFile="~/MasterPage/MasterPage.master" AutoEventWireup="true" ValidateRequest="false"
    CodeFile="EmailClient.aspx.cs" Inherits="SystemManage_EmailClient" Title="发送邮件" Culture="auto"
    meta:resourcekey="PageResource3" UICulture="auto" %>
<%@ Register Assembly="FredCK.FCKeditorV2" Namespace="FredCK.FCKeditorV2" TagPrefix="FCKeditorV2" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<script language="javascript" type="text/javascript">
    function selectAll()
    {
        var a = document.getElementsByTagName("input");
        var all = document.getElementById("alls");
        for (var i=0; i<a.length; i++)
        {
            if(all.checked)
            {
                if (a[i].type == "checkbox") 
                {
                    a[i].checked = true;
                }
            }
            else
            {
                if (a[i].type == "checkbox") 
                {
                    a[i].checked = false;
                }
            }
        }
    }
    function cancelAll()
    {
        var a = document.getElementsByTagName("input");
        for (var i=0; i<a.length; i++)
        {
            if (a[i].type == "checkbox") 
            {
                a[i].checked = false;
            }
        }
    }
</script>

<div id="myDiv" runat="server" class="divBgCover">
    </div>
    <div id="divError" runat="server" class="blue divActiveWindow">
        <table width="100%" align="center">
            <tr>
                <td>
                    <asp:ScriptManager ID="ScriptManager1" runat="server">
                    </asp:ScriptManager>
                    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                        <ContentTemplate>
                            <div class="title">
                                <asp:Label ID="lblSelectMailto" runat="server" Text="选择收件人" meta:resourcekey="lblSelectMailtoResource1"></asp:Label></div>
                            <table class="add_table" cellspacing="1" cellpadding="3">
                                <tr>
                                    <td align="right">
                                        <asp:DropDownList ID="ddlColumnName" runat="server" meta:resourcekey="ddlColumnNameResource1">
                                            <asp:ListItem Text="姓名" Value="LinkMan" meta:resourcekey="liName"></asp:ListItem>
                                            <asp:ListItem Text="E-mail" Value="Email" meta:resourcekey="liEmail"></asp:ListItem>
                                        </asp:DropDownList>
                                    </td>
                                    <td>
                                        <asp:TextBox ID="txtName" runat="server" meta:resourcekey="txtNameResource1"></asp:TextBox>
                                    </td>
                                    <td align="right">
                                        <asp:Label ID="lblClient" runat="server" Text="客户：" meta:resourcekey="lblClientResource1"></asp:Label>
                                    </td>
                                    <td>
                                        <asp:DropDownList ID="ddlClient" runat="server" meta:resourcekey="ddlClientResource1"
                                            Width="100px">
                                        </asp:DropDownList>
                                        <cc1:ListSearchExtender ID="ListSearchExtender2" runat="server" TargetControlID="ddlClient"
                                            PromptCssClass="ListSearchExtenderPrompt">
                                        </cc1:ListSearchExtender>
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="4" align="center">
                                        <asp:Button ID="btnSearch" runat="server" CssClass="btn" Text="搜索" OnClick="btnSearch_Click"
                                            meta:resourcekey="btnSearchResource1" />
                                    </td>
                                </tr>
                            </table>
                            <div id="divEntrust" runat="server">
                                <div class="list_title">
                                    <div class="autoleft">
                                        <asp:Label ID="lblTotal" runat="server" meta:resourcekey="lblTotalResource1"></asp:Label>
                                        <asp:Label ID="lblRecordFound" runat="server" Text="条记录" meta:resourcekey="lblRecordFoundResource1"></asp:Label></div>
                                    <div class="autoright">
                                        <asp:Label ID="lblPerPage" runat="server" Text="每页显示：" meta:resourcekey="lblPerPageResource1"></asp:Label>
                                        <asp:DropDownList ID="ddlPages" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlPages_SelectedIndexChanged"
                                            meta:resourcekey="ddlPagesResource1">
                                            <asp:ListItem Text="5" Value="5" meta:resourcekey="ListItemResource6"></asp:ListItem>
                                            <asp:ListItem Selected="True" Text="10" Value="10" meta:resourcekey="ListItemResource7"></asp:ListItem>
                                        </asp:DropDownList>
                                    </div>
                                </div>
                                <asp:GridView ID="gvEmailList" runat="server" AllowPaging="True" AutoGenerateColumns="False"
                                    Width="100%" AllowSorting="True" OnPageIndexChanging="gvEmailList_PageIndexChanging"
                                    OnSorting="gvEmailList_Sorting"  OnRowDataBound="gvEmailList_RowDataBound">
                                    <PagerTemplate>
                                        <table style="width: 100%">
                                            <tr>
                                                <td>
                                                    <asp:Label ID="lblPerPage" runat="server" Text="页次" meta:resourcekey="lblPerPageResource2"></asp:Label>:&nbsp;<asp:Label
                                                        ID="Label1" runat="server" Text='<%# ((GridView)Container.Parent.Parent).PageIndex+1 %>'
                                                        meta:resourcekey="Label1Resource1"></asp:Label>/<asp:Label ID="Label2" runat="server"
                                                            Text='<%# ((GridView)Container.Parent.Parent).PageCount %>' meta:resourcekey="Label2Resource2"></asp:Label><asp:Label
                                                                ID="lblPage" runat="server" Text="页" meta:resourcekey="lblPageResource1"></asp:Label>&nbsp;
                                                    <asp:Label ID="lblTotalPages" runat="server" Text="总计" meta:resourcekey="lblTotalPagesResource1"></asp:Label>:&nbsp;<asp:Label
                                                        ID="Label3" runat="server" Text="<%# ((System.Data.DataView)gvEmailList.DataSource).Count %>"
                                                        meta:resourcekey="Label3Resource1"></asp:Label>
                                                </td>
                                                <td align="right">
                                                    <asp:LinkButton ID="LinkButton1" runat="server" CommandName="Page" CommandArgument="First"
                                                        Enabled="<%# ((GridView)Container.Parent.Parent).PageIndex!=0 %>" Text="首页" meta:resourcekey="LinkButton1Resource1"></asp:LinkButton>
                                                    <asp:LinkButton ID="LinkButton2" runat="server" CommandArgument="Prev" CommandName="Page"
                                                        Enabled="<%# ((GridView)Container.Parent.Parent).PageIndex!=0 %>" Text="前页" meta:resourcekey="LinkButton2Resource1"></asp:LinkButton>
                                                    <asp:LinkButton ID="LinkButton3" runat="server" CommandName="Page" CommandArgument="Next"
                                                        Enabled="<%# ((GridView)Container.Parent.Parent).PageIndex!=((GridView)Container.Parent.Parent).PageCount-1 %>"
                                                        Text="后页" meta:resourcekey="LinkButton3Resource1"></asp:LinkButton>
                                                    <asp:LinkButton ID="LinkButton4" runat="server" CommandArgument="Last" CommandName="Page"
                                                        Enabled="<%# ((GridView)Container.Parent.Parent).PageIndex!=((GridView)Container.Parent.Parent).PageCount-1 %>"
                                                        Text="尾页" meta:resourcekey="LinkButton4Resource1"></asp:LinkButton>&nbsp;
                                                    <asp:Label ID="lblTurnOn" runat="server" Text="转第" meta:resourcekey="lblTurnOnResource1"></asp:Label>
                                                    <asp:TextBox ID="txtPages" runat="server" Width="35px" meta:resourcekey="txtPagesResource1"></asp:TextBox>
                                                    <asp:Label ID="lblPages2" runat="server" Text="页" meta:resourcekey="lblPages2Resource1"></asp:Label>
                                                    <asp:LinkButton ID="lbtnGo" runat="server" Text="提交" OnClick="lbtnGo_Click" meta:resourcekey="lbtnGoResource1"></asp:LinkButton>
                                                </td>
                                            </tr>
                                        </table>
                                    </PagerTemplate>
                                    <Columns>
                                        <asp:TemplateField meta:resourcekey="TemplateFieldResource1">
                                            <HeaderTemplate>
                                                <input type="checkbox" id="alls" name="all" onclick="selectAll()" />
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <input type="checkbox" name="chkSelected" 
                                                    value='<%# DataBinder.Eval(Container.DataItem,"Email") %>' />
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="序号" meta:resourcekey="TemplateFieldResourceRowNum1">
                                            <ItemTemplate>
                                                <asp:Label ID="lblRowNum" runat="server" Text='<%#(Container as GridViewRow).RowIndex + 1%>'></asp:Label>
                                            </ItemTemplate>
                                            <ItemStyle Width="5%" />
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="客户" SortExpression="CNClient" meta:resourcekey="TemplateFieldResource2">
                                            <ItemTemplate>
                                                <asp:Label ID="lblCNClient" runat="server" Text='<%# Eval("CNClient") %>' meta:resourcekey="lblCNClientResource1"></asp:Label>
                                                <asp:Label ID="lblHKClient" runat="server" Text='<%# Eval("HKClient") %>' meta:resourcekey="lblHKClientResource1"></asp:Label>
                                                <asp:Label ID="lblENGClient" runat="server" Text='<%# Eval("ENGClient") %>' meta:resourcekey="lblENGClientResource1"></asp:Label>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="姓名" SortExpression="LinkMan" meta:resourcekey="TemplateFieldResourceEmail">
                                            <ItemTemplate>
                                                <asp:Label ID="lblLinkMan" runat="server" Text='<%# Eval("LinkMan") %>' meta:resourcekey="lblLinkManResource1"></asp:Label>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="E-mail" SortExpression="Email" meta:resourcekey="TemplateFieldResource5">
                                            <ItemTemplate>
                                                <asp:Label ID="lblEmail" runat="server" Text='<%# Eval("Email") %>' meta:resourcekey="lblEmailResource1"></asp:Label>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                    </Columns>
                                    <HeaderStyle HorizontalAlign="Center" />
                                    <PagerSettings Mode="NumericFirstLast" />
                                    <RowStyle HorizontalAlign="Center" />
                                </asp:GridView>
                            </div>
                        </ContentTemplate>
                        <Triggers>
                            <asp:AsyncPostBackTrigger ControlID="btnSearch" EventName="Click" />
                        </Triggers>
                    </asp:UpdatePanel>
                </td>
            </tr>
            <tr>
                <td align="center">
                    <asp:Button ID="btnSub" runat="server" Text="提交" CssClass="btn" OnClick="btnSub_Click"
                        meta:resourcekey="btnSubResource1" />&nbsp;&nbsp;<asp:Button ID="btnClose" CssClass="btn"
                            runat="server" Text="返回" OnClick="btnClose_Click" meta:resourcekey="btnCloseResource1" />
                    <asp:HiddenField ID="hidAdminID" runat="server" />
                </td>
            </tr>
            <tr>
                <td align="center">
                    <asp:Label ID="lblError" runat="server" Visible="False" Text="请选择一个客户!" ForeColor="Red"
                        meta:resourcekey="lblErrorResource1"></asp:Label>
                </td>
            </tr>
        </table>
    </div>
    
    <div class="title">
        &nbsp;<asp:Label ID="lblPageType" runat="server" Text="发送邮件" meta:resourcekey="lblPageTypeResource1"></asp:Label></div>
    <table class="add_table" cellspacing="1" cellpadding="3" align="center">
        <tr>
            <td align="right">
                <asp:LinkButton ID="lbtnMailto" runat="server" Text="收件人：" OnClick="lbtnMailto_Click" meta:resourcekey="lbtnMailtoResource1"></asp:LinkButton>
            </td>
            <td>
                <asp:TextBox ID="txtMailto" runat="server" Width="60%" 
                    meta:resourcekey="txtMailtoResource1"></asp:TextBox>
                <asp:Label ID="lblTips" runat="server" Text="用;号分隔" 
                    meta:resourcekey="lblTipsResource1"></asp:Label>&nbsp;
                <asp:RequiredFieldValidator ID="rqvalMailto" runat="server" ControlToValidate="txtMailto"
                    ErrorMessage="收件人不能为空" ValidationGroup="em" meta:resourcekey="rqvalMailtoResource1"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td align="right">
                <asp:Label ID="lblSubject" runat="server" Text="主题："
                        meta:resourcekey="lblSubjectResource1"></asp:Label>
            </td>
            <td>
                <asp:TextBox ID="txtSubject" runat="server" Width="60%" 
                    meta:resourcekey="txtSubjectResource1"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td align="right">
                <asp:Label ID="lblAttachment" runat="server" Text="附件："
                        meta:resourcekey="lblAttachmentReosurce1"></asp:Label>
            </td>
            <td>
                <asp:HiddenField ID="hidAttachment" runat="server" />
                <asp:Label ID="lblAtmFile" runat="server" 
                    meta:resourcekey="lblAtmFileResource1"></asp:Label>
            </td>
        </tr>
        <tr>
            <td align="right">
                <asp:Label ID="lblContent" runat="server"
                        Text="正文：" meta:resourcekey="lblContentResource1"></asp:Label>
            </td>
            <td>
                <fckeditorv2:fckeditor id="txtContents" runat="server" Height="250px"  Width="620px"></fckeditorv2:fckeditor></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td>&nbsp;</td>
            <td align="left">
                <asp:Button ID="btnSend" runat="server" Text="发送" CssClass="btn" OnClick="btnSend_Click"
                    ValidationGroup="em" meta:resourcekey="btnSendResource1" />&nbsp;&nbsp;&nbsp;
                    <a href="#" id="lbtnReturn" runat="server" class="btn" style="padding-top: 3px;padding-bottom:3px;">
                <asp:Label ID="lblReturn" runat="server" Text="返回" 
                    meta:resourcekey="lblReturnResource1"></asp:Label></a>
            </td>
        </tr>
    </table>
</asp:Content>
